import request from '@/api/index'

// 获取会员列表
export function getMemberList(params) {
  return request({
    url: '/members',
    method: 'get',
    params
  })
}

// 获取会员详情
export function getMemberDetail(id) {
  return request({
    url: `/members/${id}`,
    method: 'get'
   })
}

// 创建会员
export function createMember(data) {
  return request({
    url: '/members',
    method: 'post',
    data
  })
}

// 更新会员
export function updateMember(id, data) {
  return request({
    url: `/members/${id}`,
    method: 'put',
    data
  })
}

// 删除会员
export function deleteMember(id) {
  return request({
    url: `/members/${id}`,
    method: 'delete'
  })
}

// 获取会员等级列表
export function getMemberLevelList() {
  return request({
    url: '/member-levels',
    method: 'get'
  })
}

// 获取会员等级详情
export function getMemberLevelDetail(id) {
  return request({
    url: `/member-levels/${id}`,
    method: 'get'
  })
}

// 创建会员等级
export function createMemberLevel(data) {
  return request({
    url: '/member-levels',
    method: 'post',
    data
  })
}

// 更新会员等级
export function updateMemberLevel(id, data) {
  return request({
    url: `/member-levels/${id}`,
    method: 'put',
    data
  })
}

// 删除会员等级
export function deleteMemberLevel(id) {
  return request({
    url: `/member-levels/${id}`,
    method: 'delete'
  })
}

// 更新会员等级状态
export function updateMemberLevelStatus(id, status) {
  return request({
    url: `/member-levels/${id}/status`,
    method: 'put',
    data: { status }
  })
}